<extend name="layout/edit" />

<block name="HEADER">

</block>

<block name="CONTENT">

	<control:form id="billform"/>
    
</block>

<block name="FOOTER">
   <script type="text/javascript">
	    var  page=(function(ns){
	    	
	    	//初始化
	    	ns.init = function(){
				$.ajaxs('/admin/v1/order_bill/details',{
					id: __oid
				}).then(function(res){
					ns.initOrderInfo(res.data.orderinfo);
					ns.initProjInfo(res.data.projinfo);
				});
	    	}
			
			//初始化订单信息
	    	ns.initOrderInfo = function(orderinfo){
	    		if(!orderinfo) return false;
	    		billform.setFormValue({
	    			total_price : orderinfo.total_price,
	    			use_integral_price : orderinfo.use_integral_price,
	    			coupon_price : orderinfo.coupon_price,
	    			use_activity_price : orderinfo.use_activity_price,
	    			pay_price : orderinfo.pay_price,
	    			shishou : '',
	    			use_balance : orderinfo.use_balance,
	    			use_git_balance : orderinfo.use_git_balance,
	    			offline_payment : orderinfo.use_offline_price,
	    			remark : orderinfo.remark,
	    		});
				billform.$grids['settleInfoGrid'].addRow( $.map(orderinfo.info.cartInfo,function(h){
					h.goods.cart_num = h.cart_num;
					return h.goods;
				}));
	    	}
	    	
	    	//初始化订单信息
	    	ns.initProjInfo = function(projinfo){
	    		if(!projinfo) return false;
	    		billform.$grids['projInfoGrid'].addRow(projinfo);
	    	}

	        //确认结算
	        ns.save=function(){
	        	$.close();
	        }
	        
	        return ns;
	    }({}));
	    
	    
	    $(function(){ page.init() });
   </script>
</block>



